[codex] Route permission requests through Oracle#858
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e62611984a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let granted = IOHIDRequestAccess(kIOHIDRequestTypeListenEvent) | ||
| _ = IOHIDRequestAccess(kIOHIDRequestTypeListenEvent) | ||
| let refreshed = await PermissionOracle.shared.forceRefresh() | ||
| let granted = refreshed.keyPath.inputMonitoring.isReady |
There was a problem hiding this comment.
Use IOHIDRequestAccess when TCC is unverifiable
When KeyPath lacks Full Disk Access, the Oracle's Input Monitoring read can stay .unknown because it falls back to TCC database access and returns nil if the DB cannot be read (PermissionOracle.tccStatus(forBundleID:)). In that common wizard state, a user can accept the IOHIDRequestAccess prompt but this line derives granted only from the refreshed Oracle snapshot, so the request returns false and the Input Monitoring page keeps polling and opens System Settings even though the system prompt succeeded. Keep the Oracle read as authoritative when it can verify, but preserve the IOHIDRequestAccess result as a fallback for the unverifiable/unknown case.
Useful? React with 👍 / 👎.
|
Code Review — PR #858: Route permission requests through Oracle Overall this is a clean, focused change that correctly enforces the Oracle pattern. The read/write split (prompt APIs as side-effects only, Oracle as the state source of truth) is well-reasoned and the ADR-001 update clearly documents the intent. Strengths
Issue 1: Outer Task in wizard pages is unstored — no cancellation on navigation Both Suggestion: store the outer task handle alongside Issue 2: If the Oracle's cached snapshot is stale (e.g., user manually granted in System Settings between the last Oracle refresh and this call), Issue 3: Fallback timer starts later than before (minor) The 1500ms fallback ( Test coverage gap The unrelated failures noted in the PR ( Summary: The Oracle routing is correct and the approach is sound. The main item worth addressing before merge is the unstored outer Task — it means neither the |
Summary
PermissionRequestServicepermission-state reads throughPermissionOracle.sharedbefore and after prompt attempts.IOHIDRequestAccessandAXIsProcessTrustedWithOptionsas prompt side effects only, with immediate Oracle refreshes after.Closes #854
Validation
/opt/homebrew/bin/swiftformat --lint Sources/KeyPathAppKit/Services/Permissions/PermissionRequestService.swift Sources/KeyPathWizardCore/WizardServiceProtocols.swift Sources/KeyPathInstallationWizard/UI/Pages/WizardInputMonitoringPage.swift Sources/KeyPathInstallationWizard/UI/Pages/WizardAccessibilityPage.swift Sources/KeyPathAppKit/Services/Permissions/PermissionGate.swiftpython3 Scripts/check-accessibility.pygit diff --checkswift build --jobs 4swift test --jobs 4 --filter PermissionGateEvaluationTestsswift buildhookNotes
./Scripts/test-fast.sh --changedfalls back to the full safe suite for this diff and failed in unrelated pack/snapshot tests: fiveCLIPackCRUDTestsfailures fromPackInstaller.swift:125(saveFailed("could not enable associated rule collection")) andHardViewSnapshotTests.testPackDetailCapsLockRemapsnapshot mismatch. Permission Oracle tests in that run passed.